package ylyhappy.cn.fileimport;

import android.app.Dialog;
import android.os.Bundle;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatDialogFragment;

import com.google.android.material.dialog.MaterialAlertDialogBuilder;

public class RationalRequestStorageAccessDialog extends AppCompatDialogFragment {
    private static final String TAG = "APPPP";
    @NonNull
    @Override
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
        Log.d(TAG, "getActiviry() is" + getActivity().getTitle());
        Listener mListener = (Listener) getActivity();

        return new MaterialAlertDialogBuilder(requireContext(), getTheme())
                .setMessage("YLY HAPPY WRITE_EXTERN_STORAGE PERMISSION")
                .setPositiveButton("YES", (e1, e2) -> {
                    mListener.onShowRequestStorageAccessRationaleResult(true);
                })
                .setNegativeButton("NO",(e1, e2) -> {
                    mListener.onShowRequestStorageAccessRationaleResult(false);
                })
                .create();
    }
    interface Listener {
        void onShowRequestStorageAccessRationaleResult(boolean isYes);
    }
}
